"
This baseline is used to generate Pharo images from the local clone of pharo-project/pharo repository. 

Depends on:
- BasicTools
- Traits
- Shift
- Slots
- Athens

Load type: 
- linear

Installs:
- Epicea
- decompiler
- tests
- refactoring
- GT Tools
- Versionner
- TxText
- OSWindow
- QualityAssistant
- some other packages
 
"
Class {
	#name : 'BaselineOfIDE',
	#superclass : 'BaselineOf',
	#instVars : [
		'repository'
	],
	#classVars : [
		'Initialized'
	],
	#category : 'BaselineOfIDE-Baseline',
	#package : 'BaselineOfIDE',
	#tag : 'Baseline'
}

{ #category : 'baselines' }
BaselineOfIDE >> baseline: spec [

	<baseline>
	repository := self packageRepositoryURLForSpec: spec.
	spec for: #common do: [
		spec postLoadDoIt: #postload:package:.
		spec baseline: 'BasicTools' with: [ spec repository: repository ].
		spec
			package: 'Tool-MorphicProfiler'
			with: [ spec requires: #( 'BasicTools' ) ].
		spec baseline: 'Athens' with: [ spec repository: repository ].
		spec baseline: 'Flashback' with: [ spec repository: repository ].

		self
			load: 'Shift' group: 'shift-tests' spec: spec;
			load: 'Traits' group: 'traits-tests' spec: spec;
			load: 'Slot' group: 'slot-tests' spec: spec;
			load: 'Clap' group: 'development' spec: spec;
			load: 'SUnit' group: 'Tests' spec: spec;
			load: 'EnlumineurFormatter' group: 'Tests' spec: spec;
			load: 'Reflectivity' group: 'tests' spec: spec;
			load: 'DebugPoints' group: 'Tests' spec: spec;
			load: 'Refactoring' group: 'Tests' spec: spec.

		spec package: 'Math-Operations-Extensions-Tests'.
		spec package: 'Network-Tests'.
		spec package: 'Network-Mail-Tests'.
		spec package: 'Rubric-SpecFindReplaceDialog'.

		spec package: 'OpalCompiler-UI'.
		spec package: 'OpalCompiler-UI-Tests'.

		self load: 'Metacello' group: 'Tests' spec: spec.

		spec baseline: 'ReflectionMirrors' with: [ spec repository: repository ].
		spec baseline: 'FuzzyMatcher' with: [ spec repository: repository ].
		spec baseline: 'QA' with: [ spec repository: repository ].
		spec baseline: 'GeneralTests' with: [ spec repository: repository ].

		"Later we will load the UI of enlumineur probably here
		"
		spec baseline: 'Shout' with: [ spec repository: repository ].
		spec baseline: 'OSWindow' with: [ spec repository: repository ].
		spec
			baseline: 'EmergencyDebugger'
			with: [ spec repository: repository ].

		self load: 'Epicea' group: 'Browsers' spec: spec.

		spec baseline: 'Misc' with: [ spec repository: repository ].

		self load: 'Fuel' group: 'Tests' spec: spec.

		self load: 'Keymapping' group: 'Tests' spec: spec.

		spec baseline: 'Zodiac' with: [ spec repository: repository ].
		spec baseline: 'SortFunctions' with: [ spec repository: repository ].
		spec baseline: 'Equals' with: [ spec repository: repository ].

		self load: 'NewValueHolder' group: 'tests' spec: spec.
		spec package: 'STON-Extensions'.

		spec package: 'BaselineOfPharoBootstrap'.
		spec package: 'BaselineOfMonticello'.
		spec package: 'BaselineOfMetacello'.
		spec baseline: 'ReferenceFinder' with: [ spec repository: repository ].
		spec baseline: 'ClassParser' with: [ spec repository: repository ].


		self
			load: 'Calypso'
			group: #( 'FullEnvironment' 'SystemBrowser' 'Tests' )
			spec: spec.
		spec baseline: 'Ring' with: [ spec repository: repository ].
		spec baseline: 'HeuristicCompletion' with: [ spec repository: repository ].
		spec package: 'Tool-DependencyAnalyser-UI-Tab' with: [
			"Depends also on the dependency analyser in newtools"
			spec requires: #('Calypso') ].
		self specCode: spec.
		self roassal: spec.
		self microdown: spec.
		self newTools: spec.
		self drTests: spec.

		spec project: 'Clap-UI' copyFrom: 'Clap' with: [ spec loads: #('ui') ].

		spec package: #'BeautifulComments'  with: [ spec requires:  #( 'Microdown') ].
		
		spec package: 'IconPacks'.
		spec package: 'Kernel-ExtraUtils' ]
]

{ #category : 'actions' }
BaselineOfIDE >> classNamed: aSymbol [

	^ self class environment classNamed: aSymbol
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> documentBrowserCore: spec [

	spec baseline: 'NewToolsDocumentBrowser' with: [
		spec
			repository: (self classNamed: #BaselineOfPharo) documentBrowserRepository;
			loads: 'Core+Tests' ]
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> drTests: spec [

	spec
		baseline: 'DrTests'
		with: [ spec repository: (self packageRepositoryURLForSpec: spec) ]
]

{ #category : 'private - loading' }
BaselineOfIDE >> load: aProject group: aGroupName spec: spec [

	spec baseline: aProject with: [
		spec
			repository: (self packageRepositoryURLForSpec: spec);
			loads: aGroupName ]
]

{ #category : 'actions' }
BaselineOfIDE >> loadExtraTools [
	"Load NewTools-DocumentBrowser-GitHubResource packages depending on Iceberg GitHub plugin"

	Metacello new
		baseline: 'NewToolsDocumentBrowser';
		repository: (self classNamed: #BaselineOfPharo) documentBrowserRepository;
		onConflictUseIncoming;
		load.

	"Hack: Document Browser is loaded in 2 steps because of the dependency of some packages to Iceberg.
	The 2nd load is done through Metacello that adds new project registrations in Iceberg (user, not system).
	We then remove these last registrations."
	#('NewTools-DocumentBrowser' 'iceberg') do: [ :repositoryName | | foundRepo |
		foundRepo := IceRepository registry 
			detect: [ :repo | repo name = repositoryName ]
			ifNone: [ self error: repositoryName , ' not found in Iceberg registry!' ].
		IceRepository unregisterRepository: foundRepo ifAbsent: [ "ignore" ] ].
]

{ #category : 'actions' }
BaselineOfIDE >> loadIceberg [

	Metacello new
		baseline: 'Iceberg';
		repository: (self classNamed: #BaselineOfPharo) icebergRepository;
		onConflictUseLoaded;
		load.
	(self classNamed: #Iceberg) enableMetacelloIntegration: true.

	Smalltalk os environment at: #GITHUB_TOKEN ifPresent: [ :token |
		| credentials |
		credentials := (self classNamed: #IceTokenCredentials) new
			               username:
				               (Smalltalk os environment
					                at: #GITHUB_USER
					                ifAbsent: [ self error: 'Github token was found but not the github user associated to this token.' ]);
			               token: token;
			               host: 'github.com';
			               yourself.

		(self classNamed: #IceCredentialStore) current storeCredential: credentials forHostname: 'github.com'.
		'Using authentification for Github API' traceCr ].

	self registerPharo.
	self registerProject: 'Spec2' baseline: 'Spec2' otherBaselines: #('SpecCore').
	self registerProject: 'NewTools'.
	self registerProject: 'Roassal'.
	self registerProject: 'Microdown'.
	self registerProject: 'DocumentBrowser' baseline: 'NewToolsDocumentBrowser' otherBaselines: #().
	self registerIceberg
]

{ #category : 'actions' }
BaselineOfIDE >> makeCalypsoDefaultBrowser [

	(self classNamed: #ClyBrowserMorph) beAllDefault.
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> microdown: spec [ 

	spec baseline: 'Microdown' with: [ 
		spec 
			repository: (self classNamed: #BaselineOfPharo) microdownRepository;
			loads: #('RichText' 'Tests' 'ForPharo') ]
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> newTools: spec [ 

	spec baseline: 'NewTools' with: [
		spec 
			repository: (self classNamed: #BaselineOfPharo) newToolsRepository;
			loads: #('default') ].
]

{ #category : 'private - register' }
BaselineOfIDE >> pharoPluginClass [
	
	^ self classNamed: #IcePharoPlugin
]

{ #category : 'actions' }
BaselineOfIDE >> postload: loader package: packageSpec [
	"Ignore pre and post loads if already executed"

	Initialized = true ifTrue: [ ^ self ].

	"collect and process the standard tools registrations"
	self tools initDefaultToolSet.

	EpMonitor current enable.

	self tools
		register: ExternalChangesBrowser as: #changeList;
		register: StFileSystemPresenter as: #fileList;
		register: StFinderPresenter as: #finder;
		register: StProcessBrowser as: #processBrowser.

	(MorphicCoreUIManager readClassVariableNamed: #UIProcess) ifNotNil: [ :proc | proc terminate ].
	MorphicCoreUIManager writeClassVariableNamed: #UIProcess value: nil.

	PolymorphSystemSettings desktopColor: Color veryVeryLightGray lighter.
	SourceCodeFonts setSourceCodeFonts: 10.
	FreeTypeSystemSettings loadFt2Library: true.
	FreeTypeSettings current monitorType: #LCD.
	FreeTypeSettings current glyphContrast: 55.

	RealEstateAgent usedStrategy: #cascadeFor:initialExtent:world:.
	GrowlMorph position: #bottomLeft.
	ShortcutReminder enabled: true.

	KMRepository reset.
	Morph shortcutsHandler: KMShortcutHandler new.

	OCProgramNode formatterClass: (self class environment at: #EFFormatter ifAbsent: [ OCSimpleFormatter ]).

	Color flushCache.

	RubTextFieldArea defaultFindReplaceServiceClass: SpRubFindReplaceService.
	RubEditingArea defaultFindReplaceServiceClass: SpRubFindReplaceService.

	RubCharacterScanner initialize.

	RubAbstractTextArea highlightMessageSend: true.

	(self class environment at: #PolymorphSystemSettings) defaultTheme beCurrent.

	SDL_Event initialize.

	HiRulerBuilderTest initialize.

	"Making HeuristicCompletion the default completion engine"
	RubSmalltalkEditor completionEngineClass: CoCompletionEngine.

	self loadIceberg.
	self loadExtraTools.
	self makeCalypsoDefaultBrowser.

	Initialized := true.
]

{ #category : 'actions' }
BaselineOfIDE >> registerIceberg [
	
	self pharoPluginClass addIcebergProjectToIceberg.
	"Register baselines"
	Metacello new baseline: 'Tonel'; register.
	Metacello new baseline: 'LibGit'; register.
	Metacello new baseline: 'Iceberg'; register
]

{ #category : 'actions' }
BaselineOfIDE >> registerPharo [
	
	self pharoPluginClass addPharoProjectToIceberg
]

{ #category : 'private - register' }
BaselineOfIDE >> registerProject: projectName [

	^ self 
		registerProject: projectName 
		baseline: projectName 
		otherBaselines: #()
]

{ #category : 'private - register' }
BaselineOfIDE >> registerProject: projectName baseline: baselineName [

	^ self 
		registerProject: projectName 
		baseline: baselineName 
		otherBaselines: #()
]

{ #category : 'private - register' }
BaselineOfIDE >> registerProject: projectName baseline: baselineName otherBaselines: anArray [

	^ self 
		registerProject: projectName
		externalProject: projectName
		baseline: baselineName 
		otherBaselines: anArray
]

{ #category : 'private - register' }
BaselineOfIDE >> registerProject: projectName externalProject: externalProject [

	^ self 
		registerProject: projectName 
		externalProject: externalProject
		baseline: projectName 
		otherBaselines: #()
]

{ #category : 'private - register' }
BaselineOfIDE >> registerProject: projectName externalProject: externalProject baseline: baselineName otherBaselines: anArray [
	| baselineClass className |

	className := ('BaselineOf', baselineName) asSymbol.
	baselineClass := self classNamed: className.
	baselineClass ifNil: [ ^ self ].

	self pharoPluginClass
		addProjectNamed: projectName
		commit: (self pharoPluginClass commitOfExternalProject: externalProject)
		baselines: { className }
		tags: #(#system).
	"Register baselines"
	({baselineName}, anArray) do: [ :each |
		Metacello new baseline: each; register ]
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> roassal: spec [

	spec 
		baseline: 'Roassal' 
 		with: [ 
			spec 
				repository: (self classNamed: #BaselineOfPharo) roassalRepository;
    			loads: #( 'Core' 'Tests') ]
]

{ #category : 'baselines - dependencies' }
BaselineOfIDE >> specCode: spec [

	spec baseline: 'SpecCode' with: [ 
		spec
			repository: (self classNamed: #BaselineOfPharo) specRepository;
			className: 'BaselineOfSpec2';
			loads: #('Code' 'CodeTests') ]
]
